{template header}

    {template sidebar}
    <!-- artile begin -->
    <div class="article">
     {template title}

<!--{if $type == 'infoMan'}-->
<!--{if $a == 'index' || $a == 'search_hotSale'}-->

     <form class="form-search" action="{$this->url($c, 'search_hotSale', $this->get())}">
         <table>
             <tr><td class="td1" width="20%">商品编号：</td>
                 <td>

                     <div class="input-append">
                         <input type="text" name="key" class="span2 search-query" placeholder="请输入商品编号" />
                         <button type="button" class="btn search">搜索</button>
                     </div>
                 </td >
             </tr>
         </table>

     </form>
        <table>
            <tr>
                <th width="5%"><input type="checkbox" class="checkbox all" /> </th>
                <th width="20%">商品编号</th>
                <th width="10%">货号</th>
                <th width="10%">价格</th>
                <th width="15%">销售数量</th>
                <th width="15%">操作</th>
            </tr>
        <!--{if $result}-->
            <!--{loop $result $v}-->
            <tr>
                <td><input type="checkbox" name="id" value="{$v['id']}" /></td>
                <td>{$v['sn']}</td>
                <td>{$v['materialNo']}</td>
                <td>{$v['price']}</td>
                <td>{$v['total']}</td>
                <td class="operate">
                    <a href="{$this->url($c,'edit',array('id'=>$v['id'],'type'=>'infoMan'))}">编辑</a>
                    <a title="删除商品" class="del" href="{$this->url($c,'del',array('id'=>$v['id']))}">删除</a>
                </td>
            </tr>
            <!--{/loop}-->
        <!--{else}-->
            <tr>
                <td colspan="6">没有{$this->name}！
                </td>
            </tr>
        <!--{/if}-->

        <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="6">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
        <!--{/if}-->
            <tr>
                <td colspan="4" class="td4">
                    <a title="添加热卖商品" class="btn btn-success " href="{$this->url('hotSale','add')}">添加热卖商品</a>
                </td>
            </tr>
        </table>

    <!--{/if}-->
     <!--{if $a == 'add' || $a == 'edit'}-->
        <form method="post" action="{$this->url($c, 'save', array('id' => $result['id']))}">
            <input type="hidden" name="attach[id]" value="" />
            <input type="hidden" name="uid" value="{$this->admin['id']}" />
            <table>
                <tr>
                    <td class="td1" width="25%">商品编号：</td>
                    <td class="td2 operate">
                        <input type="text" name="sn" placeholder="请输入商品编号" class="required" value="{$a == 'edit' ? $result['sn'] : ''}"/>
                        <a format="YmdHis" class="sn" href="{$this->url($c)}">自动生成</a>
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品名称：</td>
                    <td class="td2">
                        <input type="text" name="title" placeholder="请输入商品名称" class="required input-xlarge" value="{$a == 'edit' ? $result['title'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品货号：</td>
                    <td class="td2">
                        <input type="text" name="materialNo" placeholder="请输入商品名称" class="required input-xlarge" value="{$a == 'edit' ? $result['materialNo'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">统计周期：</td>
                    <td class="td2">
                        <input type="text" name="materialNo" placeholder="请输入商品名称" class="required input-xlarge" value="{$a == 'edit' ? $result['materialNo'] : ''}" />
                    </td>
                </tr>


                <tr>
                    <td class="td1">适合年龄：</td>
                    <td class="td2">
                        <select name="age">
                            <!--{loop $this->age $k $v}-->
                            {eval $select_age = $k == $result['age'] ? ' selected' : ''}
                            <option value="{$k}"{$select_age}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品风格：</td>
                    <td class="td2">
                        <select name="style">
                            <!--{loop $this->style $k $v}-->
                            {eval $select_style = $k == $result['style'] ? ' selected' : ''}
                            <option value="{$k}"{$select_style}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品种类：</td>
                    <td class="td2">
                        <select name="clothType">
                            <!--{loop $this->salerType $k $v}-->
                            {eval $select_salerType = $k == $result['clothType'] ? ' selected' : ''}
                            <option value="{$k}"{$select_salerType}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">信息来源：</td>
                    <td class="td2">
                        <select name="source">
                            <!--{loop $this->source $k $v}-->
                            {eval $select = $k == $result['source'] ? ' selected' : ''}
                            <option value="{$k}"{$select}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">所在地：</td>
                    <td class="td2">
                        <select name="addr">
                            <!--{loop $this->addr $k $v}-->
                            {eval $select_addr = $k== $result['addr'] ? ' selected' : ''}
                            <option value="{$k}"{$select_addr}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">所属品牌：</td>
                    <td class="td2">
                        <select name="brand">
                            <!--{loop $this->brand $k $v}-->
                            {eval $select_brand = $k == $result['brand'] ? ' selected' : ''}
                            <option value="{$k}"{$select_brand}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">商家名称：</td>
                    <td class="td2">
                        <input type="text" name="merchant" placeholder="请输入商家名称" class="required input-xlarge" value="{$a == 'edit' ? $result['merchant'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品的URL：</td>
                    <td class="td2">
                        <input type="text" name="url" placeholder="请输入商品URL" class="required input-xlarge" value="{$a == 'edit' ? $result['url'] : ''}" />
                    </td>
                </tr>

                <tr>
                    <td class="td1">销售数量：</td>
                    <td class="td2">
                        <input type="text" name="total" placeholder="请输入商品销售数量" class="required" value="{$a == 'edit' ? $result['total'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品销售价格：</td>
                    <td class="td2">
                        <input type="text" name="price" placeholder="请输入商品销售价格" class="required" value="{$a == 'edit' ? $result['price'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">录入时间：</td>
                    <td class="td2 operate">
                        <input type="text" name="dateline" value="{$a == 'edit' ? date($this->setting['timeformat'], $result['dateline']) : date($this->setting['timeformat'])}" readonly />
                        <a href="" format="{$this->setting['timeformat']}" class="dateline">插入当前时间</a>
                    </td>
                </tr>
                {template upload}
                <tr>
                    <th colspan="2" class="td4"><a title="保存{$this->name}" class="btn btn-success save" href="{$this->url($c)}">保存</a></th>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            $( ".style,.brand" ).click( function () {
                var c = $( this ).attr( 'class' );
                $( 'input[name="' + c + '"]' ).val( $( this ).html() );
                $( 'input[name="' + c + '"]' ).focus();
                return false;
            });
            $( ".sn, .dateline" ).click( function () {
                var c = $( this ).attr( 'class' );
                $.get( "{$this->url($c, 'get_date')}&format=" + $( this ).attr( 'format' ), function ( result ) {
                    $( 'input[name="' + c + '"]' ).val( result );
                    $( 'input[name="' + c + '"]' ).focus();
                });
                return false;
            });
        </script>
    <!--{/if}-->
    <!--{/if}-->


    <!--{if $type == 'infoShow'}-->
        <!--{if $a != 'addClothEvaluate' && $a != 'lookClothEvaluate' }-->
        <!-- 信息展示 -->

     <style type="text/css">
         #filter
         {
             width:620px;
             height:auto;
             margin-left:auto;
             margin-right:auto;
             font-size:12px;
         }

         #filter dl
         {
             padding:0;
             margin-top:0;
             margin-bottom:0;
             clear:both;
             padding:4px 0;
         }

         #filter dt,dd
         {
             display:block;
             float:left;
             width:auto;
             padding:0;
             margin:3px 0;
         }

         #filter dt
         {
             height:14px;
             padding-bottom:4px;
             font-weight:bold;
             color:#333333;
         }

         #filter dd
         {
             color:#005AA0;
             margin-right:8px;
         }

         #filter a
         {
             cursor:pointer;
         }

         .seling
         {
             background-color:#005AA0;
             color:#FFFFFF;
         }

         .seled
         {
             background-color:#005AA0;
             color:#FFFFFF;
         }
     </style>
     <script type="text/javascript">
         $(function () {
             //选中filter下的所有a标签，为其添加hover方法，该方法有两个参数，分别是鼠标移上和移开所执行的函数。
             $("#filter a").hover(
                     function () {
                         $(this).addClass("seling");
                     },
                     function () {
                         $(this).removeClass("seling");
                     }
             );


             //选中filter下所有的dt标签，并且为dt标签后面的第一个dd标签下的a标签添加样式seled。(感叹jquery的强大)
            // $("#filter dt+dd a").attr("class", "seled"); /*注意：这儿应该是设置(attr)样式，而不是添加样式(addClass)，
             // 不然后面通过$("#filter a[class='seled']")访问不到class样式为seled的a标签。*/

             //为filter下的所有a标签添加单击事件
             $("#filter a").click(function () {
                 $(this).parents("dl").children("dd").each(function () {
                     //下面三种方式效果相同（第三种写法的内部就是调用了find()函数，所以，第二、三种方法是等价的。）
                    // $(this).children("div").children("a").removeClass("seled");
                     //$(this).find("a").removeClass("seled");
                      $('a',this).removeClass("seled");
                 });

                 $(this).attr("class", "seled");

                 window.location.href = "?c=hotSale&a=search_mulCondition&" + RetSelecteds() ;

             });
             //alert(RetSelecteds()); //返回选中结果   弹出
             // window.location.href = "?c=hotSale&a=search_mulCondition&"+RetSelecteds();
         });

         function RetSelecteds() {
             var result = "";

             /*$("#filter a[class='seled']").each(function () {
              result += $(this).html()+"\n";
              });*/
             if($("#salerType a[class='seled']").html() != null)
             result += "salerType=" +$("#salerType a[class='seled']").html();
             if($("#source a[class='seled']").html() != null)
             result += "&" +"source=" + $("#source a[class='seled']").html();
             if($("#age a[class='seled']").html() != '')
             result += "&" +"age=" + $("#age a[class='seled']").html();
             if($("#costPrice a[class='seled']").html() != '')
             result += "&" +"costPrice=" + $("#costPrice a[class='seled']").html();
             if($("#addr a[class='seled']").html() != '')
             result += "&" +"addr=" + $("#addr a[class='seled']").html();
             return result;
         }
     </script>

     <div id="filter">
         <dl id="salerType">
             <dt>商品种类：</dt>
             <!--{loop $this->salerType $v}-->
             <dd><div><a{echo G('salerType', '全部') == $v ?  ' class ="seled"' : ''}>{$v}</a></div></dd>
             <!--{/loop}-->
         </dl>
         <dl id="source">
             <dt>商品来源：</dt>
             <!--{loop $this->source $v}-->
             <dd><div><a{echo G('source', '全部') == $v ?  ' class ="seled"' : ''}>{$v}</a>&nbsp;&nbsp;&nbsp;&nbsp;</div></dd>
             <!--{/loop}-->
         </dl>
         <dl id="age">
             <dt>适合年龄：</dt>
             <!--{loop $this->age $v}-->
             <dd><div><a{echo G('age', '全部') == $v ?  ' class ="seled"' : ''}>{$v}</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></dd>
             <!--{/loop}-->
         </dl>
         <dl id="costPrice">
             <dt>进货价格：</dt>
             <!--{loop $this->costPrice $v}-->
             <dd><div><a{echo G('costPrice', '全部') == $v ?  ' class ="seled"' : ''}>{$v}</a>&nbsp;&nbsp;&nbsp;</div></dd>
             <!--{/loop}-->
         </dl>
         <dl id="addr">
             <dt>所 在 地：</dt>
             <!--{loop $this->addr $v}-->
             <dd><div><a{echo G('addr', '全部') == $v ?  ' class ="seled"' : ''}>{$v}</a></div>&nbsp;&nbsp;&nbsp;&nbsp;</dd>
             <!--{/loop}-->
         </dl>
     </div>

        <table>
            <!--{if  $result}-->
            <style>

                .slideshow{ height:320px; position:relative;  width:500px;overflow:hidden;}
                .slides_container{ height:320px !important;}
                .slideshow1{ height:320px; position:relative;  width:500px;overflow:hidden;}
                .slides_container1{ height:320px !important;}
                .slideshow img{ width:500px; height:320px;}
                .pagination{ float:right; position:absolute; bottom:6px; right:6px;}
                .pagination li{ float:left; margin:0 1px;}
                .pagination li a{  float:left; width:16px; height:16px; line-height:16px; font-size:12px;text-align:center;color:#333; background:#FFF; overflow:hidden; display:block;}
                .pagination li.current a{ color:#FFF; background:#06C;}
            </style>
            <!--{loop $result $val}-->

            <tr>
                <td  width=500 margin = 0>
                    <!--{if  $val['picAddr0'] && $val['picAddr1']}-->
                    <div class="slideshow">
                        <div class="slides_container">
                            <!--{if  $val['picAddr0']}-->
                            <a href="#"><img src="{$val['picAddr0']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr1']}-->
                            <a href="#"><img src="{$val['picAddr1']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr2']}-->
                            <a href="#"><img src="{$val['picAddr2']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr3']}-->
                            <a href="#"><img src="{$val['picAddr3']}" /></a>
                            <!--{/if}-->
                        </div>
                    </div>
                    <!--{else}-->

                    <!--{if  $val['picAddr0']}-->
                    <div class="slideshow1">
                        <div class="slides_container1">
                           <a href="#" ><img src="{$val['picAddr0']}" /></a>
                        </div>
                    </div>
                    <!--{/if}-->

                    <!--{/if}-->

                </td>
                <td width="300" >
                    <table>
                        <tr>
                            <td>商品编号</td>
                            <td>{$val['sn']}</td>
                        </tr>
                        <tr>
                           <td>货号:</td>
                            <td>{$val['materialNo']}</td>
                        </tr>
                        <tr>
                            <td>销售笔数:</td>
                            <td>{$val['total']}</td>
                        </tr>
                        <tr>
                            <td>销售单价:</td>
                            <td>{$val['price']}</td>
                        </tr>
                        <tr>

                            <td><a href="{$this->url($c,'addClothEvaluate', array('type' => 'infoShow','id'=>$val['id']))}">添加评价</a></td>
                            <td><a href="{$this->url($c,'lookClothEvaluate', array('type' => 'infoShow','sn'=>$val['sn']))}">历史评价</a></td>
                        </tr>
                    </table>
                </td>

            </tr>



            <!--{/loop}-->
            <script type="text/javascript" src="content/js/slides.min.jquery.js"></script>

            <script type="text/javascript">
                $(".slideshow").slides({
                    effect: 'fade',
                    play: 5000,
                    pause: 2500,
                    hoverPause: true
                });
            </script>
            <!--{else}-->
            <tr>
                <td colspan="6">热卖商品信息</td>
            </tr>

            <!--{/if}-->

            <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="6">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
            <!--{/if}-->



        </table>

        <!--{/if}-->
        <!--{/if}-->
        <!--{if $a == 'addClothEvaluate'}-->
        <form method="post" action="{$this->url($c, 'saveClothEvaluate')}">
            <input type="hidden" name="attach[id]" value="" />
            <table cellpadding="1" cellspacing="1" border="0" width="100%">
                <tr>
                    <td class="td1" width="25%">服装编号：</td>
                    <td class="td2 operate">
                        <input type="text" name="sn" placeholder="请输入商品编号" class="required" value="{$result['sn']}"/>
                        <a format="YmdHis" class="sn" href="{$this->url($c)}">自动生成</a>
                    </td>
                </tr>
                <tr>
                    <td class="td1" width="30%">服装评分：</td>
                    <td class="td2">
                        <select name="vote">

                            <!--{loop $this->clothScore  $k $v}-->
                            <option value="{$k}">{$v}</option>
                            <!--{/loop}-->

                        </select>
                    </td>


                </tr>
                <td class="td1" width="30%">服装评价：</td>
                <td class="td2">
                    <!-- class="required" 必填字段  -->
                    <input type="text" size="20" name="comments" placeholder="" class="required" value="{$a == 'edit' ? $result['comment'] : ''}" />

                </td>
                <tr>

                </tr>


                <tr>
                    <td colspan="1" class="td1">
                        <a class="btn btn-success save" href="{$this->url($c, 'lookHotSalePic', array('type'=>'infoShow'))}">保存</a>
                    </td>
                    <td colspan="1" class="td1">
                        <a class="btn btn-success save" href="{$this->url($c)}">重置</a>
                    </td>
                </tr>
            </table>
        </form>
        <!--{/if}-->
        <!--{if $a == 'lookClothEvaluate'}-->
        <table cellpadding="1" cellspacing="1" border="0" width="100%">




            <tr>
                <th width="15%">服装编号</th>
                <th>评分</th>
                <th>评价</th>
                <th>评论员</th>
                <th>评价时间</th>
            </tr>

            <!--{if $result}-->
            <!--{loop $result  $v}-->
            <tr>

                <td>{$v['sn']}</td>
                <td>{$v['vote']}</td>
                <td>{$v['comments']}</td>
                <td>{$v['user']}</td>
                <td>{$v['dateline']}</td>
            </tr>
            <!--{/loop}-->


            <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="5">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
            <!--{/if}-->

            <!--{else}-->
            <tr>
                <td colspan="5">没有数据记录！</td>
            </tr>
            <!--{/if}-->

        </table>

        <!--{/if}-->

    </div>
    <!-- artile end -->

    <script type="text/javascript">

    $( ".sn" ).click( function () {
        var c = $( this ).attr( 'class' );
        $.get( "{$this->url($c, 'get_date')}&format=" + $( this ).attr( 'format' ), function ( result ) {
            $( 'input[name="' + c + '"]' ).val( result );
            $( 'input[name="' + c + '"]' ).focus();
        });
        return false;
    });
</script>

{template footer}